﻿using UnityEngine;
using System.Collections;

namespace COC.Content.Task {

    public class YieldInstructionTask : IEnumerator
    {
        public object Current { get { return _enumerator.Current; } }

        public YieldInstructionTask(YieldInstruction instruction)
        {
            _enumerator = ConvertIt(instruction);
        }

        IEnumerator ConvertIt(YieldInstruction instruction)
        {
            yield return instruction;
        }

        virtual public bool MoveNext()
        {
            return _enumerator.MoveNext();
        }
        public void Reset()
        {
            _enumerator.Reset();
        }

        private IEnumerator _enumerator;
    }
}